package com.authine.cloudpivot.ext.service;

import com.alibaba.cola.dto.SingleResponse;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeCancelPayment;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeMemberPurchaseOrder;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeePurchaseReceipt;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeRequestPayment;
import com.authine.cloudpivot.ext.kingdee.work.TransferPurchaseWork;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
 * @Author: liwei
 * @DateTime: 2021/7/6
 * @Description: 转采部分生成凭证服务
 */
@Slf4j
public class TransferPurchaseVoucherService {

    private TransferPurchaseWork transferPurchaseService = new TransferPurchaseWork();

    /* 转采退货生成凭证 */
    public SingleResponse purchaseReturnCertificate( KingDeeMemberPurchaseOrder memberPurchaseOrder) {
        Assert.notNull(memberPurchaseOrder, "转采退货生成凭证 入参数据为空");

        return transferPurchaseService.purchaseReturnCertificate(memberPurchaseOrder);
    }

    /* 转采确认付款生成凭证 */
    public SingleResponse paymentCredentialGeneration( List<KingDeeRequestPayment> kingDeeRequestPaymentList) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeRequestPaymentList), "转采确认付款生成凭证 入参数据为空");

        return transferPurchaseService.paymentCredentialGeneration(kingDeeRequestPaymentList);
    }

    /*  转采确认收票生成凭证 */
    public SingleResponse receiptCredentialGeneration( List<KingDeePurchaseReceipt> kingDeePurchaseReceiptList) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeePurchaseReceiptList), "转采确认收票生成凭证 入参数据为空");

        return transferPurchaseService.receiptCredentialGeneration(kingDeePurchaseReceiptList);
    }



    /* 取消付款删除凭证 */
    public SingleResponse cancelPaymentDeletionVoucher(List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "取消付款删除凭证 入参数据为空");

        return transferPurchaseService.cancelPaymentDeletionVoucher(kingDeeCancelPayments);
    }

    /* 转采取消收票删除凭证 */
    public SingleResponse purchaseCancelBillingDeleteVoucher( List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "转采取消收票删除凭证 入参为空");

        return transferPurchaseService.purchaseCancelBillingDeleteVoucher(kingDeeCancelPayments);
    }

    /* 修改收票时间凭证 */
    public SingleResponse modifyTheInvoiceTimeToGenerateTheVoucher( KingDeePurchaseReceipt purchaseInvoice) {
        Assert.notNull(purchaseInvoice, "修改收票时间凭证 入参为空");

        return transferPurchaseService.modifyTheInvoiceTimeToGenerateTheVoucher(purchaseInvoice);
    }


    /* 修改付款时间凭证 */
    public SingleResponse modifyPaymentTimeVoucher( KingDeeRequestPayment kingDeeRequestPayment) {
        Assert.notNull(kingDeeRequestPayment, "修改付款时间凭证 入参为空");

        return transferPurchaseService.modifyPaymentTimeVoucher(kingDeeRequestPayment);
    }


}
